#Region " Imports "

Imports System
Imports System.Data
Imports System.Configuration
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports BA.DAL

#End Region

Public Class UserControlBase
    Inherits Helpers

#Region " Members "

    Private _ControlName As String = ""
    Private _ControlPath As String = ""
    Private _DisplayName As String = ""

#End Region

#Region " Properties "

    Public ReadOnly Property ControlName() As String
        Get
            Return _ControlName
        End Get
    End Property

    Public ReadOnly Property ControlPath() As String
        Get
            Return _ControlPath
        End Get
    End Property

    Public ReadOnly Property DisplayName() As String
        Get
            Return _DisplayName
        End Get
    End Property

#End Region

#Region " Methods "

    Protected Sub SetPageTitle(ByVal PageTitle As String)

        Me.Page.Title = String.Format("{0} {1}", SiteTitle, PageTitle)

    End Sub

    Public Sub GetControlValues(ByVal RequestedPage As String)
        Dim ControlDataSet As DataSet = New DataSet

        Try
            Dim DAL As BA.DAL.DBUtility = New BA.DAL.DBUtility
            DAL.CreateDBObjects(ConnectionString, Provider)
            DAL.AddParameter("@control", RequestedPage)

            If IsNumeric(RequestedPage) Then
                ControlDataSet = DAL.GetDataSet("usp_get_control_byid", CommandType.StoredProcedure, ConnectionState.Open)
            Else
                ControlDataSet = DAL.GetDataSet("usp_get_control_byname", CommandType.StoredProcedure, ConnectionState.Open)
            End If

            _ControlName = CType(ControlDataSet.Tables(0).Rows(0).Item("controlname"), String)
            _ControlPath = CType(ControlDataSet.Tables(0).Rows(0).Item("controlpath"), String)
            _DisplayName = CType(ControlDataSet.Tables(0).Rows(0).Item("displayname"), String)

        Catch
            _ControlName = "main"
            _ControlPath = "usercontrols"
            _DisplayName = "Main"
        End Try

    End Sub

#End Region

End Class